// pages/ucenter/index/index.js
const app = getApp()
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
Page({
  data: {
      nickname:'',
    name:'',
    avatarUrl: defaultAvatarUrl,
  },
  onLoad() {
      if (wx.getStorageSync('nickname')) {
        this.setData({ 
            nickname: wx.getStorageSync('nickname')
        });
      }
  }, 
  onChooseAvatar(e) {
    const { avatarUrl } = e.detail  
    console.log("chooseAvatar:", e)
    this.setData({
      avatarUrl,
    })
  },
  inputChange(e) {
    const { name } = e.detail  
    console.log("name:", e)
    this.setData({
      name,
    })
  },
    redirectToLogs: function() {
      wx.navigateTo({
        url: '/pages/logs/logs'
      });
    },
    tointro: function() {
        wx.navigateTo({
          url: '/pages/intro/intro'
        });
      },
      tosetting: function() {
        wx.navigateTo({
          url: '/pages/setting/setting'
        });
      }
})
